package com.zf.shuashua.bean;

import android.text.TextUtils;

/**
 * 消息通知首页
 */
public class NotificationInfo {

    //未读点赞数
    public String un_read_praise_count;
    //未读评论数
    public String un_read_comment_count;
    //未读关注数
    public String un_read_follow_count;
    //未读小助手数
    public String un_read_notice_count;
    //通知标题
    public String notice_title;

    public boolean hasUnread(){
        int praiseCount = getFormatCount(un_read_praise_count);
        int commentCount = getFormatCount(un_read_comment_count);
        int followCount = getFormatCount(un_read_follow_count);
        int noticeCount = getFormatCount(un_read_notice_count);
        int totalCount = praiseCount + commentCount + followCount + noticeCount;
        return totalCount > 0;
    }

    public int getFormatCount(String countStr){
        if(TextUtils.isEmpty(countStr)){
            return 0;
        }
        if(countStr.contains("+")){
            return 99;
        }
        int count = 0;
        try{
            count = Integer.parseInt(countStr);
        }catch (Exception e){

        }
        return count;
    }
}
